const initRect = {
  x: 100,
  y: 100,
  width: 200,
  height: 200
}

export enum ControlBalls {
  TL = 'tl',
  TM = 'tm',
  TR = 'tr',
  MR = 'mr',
  BR = 'br',
  BM = 'bm',
  BL = 'bl',
  ML = 'ml',
  CENTER = 'center'
}

const initBallsPosition = () => {
  console.log('init Balls')
  const { x, y, width, height } = initRect
  // 多边形的顶点
  let points = [
    { x: x, y: y, pType: ControlBalls.TL },
    { x: x + width / 2, y: y, pType: ControlBalls.TM },
    { x: x + width, y: y, pType: ControlBalls.TR },

    { x: x + width, y: y + height / 2, pType: ControlBalls.MR },

    { x: x + width, y: y + height, pType: ControlBalls.BR },
    { x: x + width / 2, y: y + height, pType: ControlBalls.BM },
    { x: x, y: y + height, pType: ControlBalls.BL },

    { x: x, y: y + height / 2, pType: ControlBalls.ML }
  ]


  const centerOp = {
    x: x + width / 2,
    y: y + height / 2
  }

  return {
    points,
    centerOp
  }
}


export {
  initBallsPosition
}
